import requests
import base64
import hashlib
import sys


#发送普通消息
def send_text(text):
    text = "自动化测试已完成\n测试报告地址:"+text
    url = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=12750a64-f1df-4403-812b-d8edfcb8df87"
    headers = {"Content-Type": "text/plain"}
    data = {
          "msgtype": "text",
          "text": {
             "content": text,
          }
    }

    r = requests.post(url, headers=headers, json=data)
    print(r.text)

#发送markdown消息
def send_markdown(text):
    url = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=e36e61d2-c9aa-4e9e-a9c0-5d680cbfb5e1"
    data = {
    "msgtype": "markdown",
    "markdown": {
        "content": text
    }}
    r = requests.post(url,json=data)
    print(r.text)

if __name__ == '__main__':
    send_text(sys.argv[1])